﻿using System;

namespace RedisDotNet
{
    /// <summary>
    /// Redis low level network client
    /// </summary>
    public interface IRedisNetworkClient : IDisposable
    {
        /// <summary>
        /// Issues a simple command to the redis server
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="parameters">The parameters.</param>
        void IssueSimpleCommand(string command, params string[] parameters);

        /// <summary>
        /// Issues the bulk command to the redis server with string data
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="key">The key.</param>
        /// <param name="data">The data.</param>
        void IssueBulkCommand(string command, string key, string data);

        /// <summary>
        /// Issues the bulk command to the redis server with binary data
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="key">The key.</param>
        /// <param name="data">The data.</param>
        void IssueBulkCommand(string command, string key, byte[] data);

        /// <summary>
        /// Waits for an integer reply from the server
        /// </summary>
        /// <returns>Integer reply value</returns>
        int ExpectIntegerReply();

        /// <summary>
        /// Waits for a single line reply from the server
        /// </summary>
        /// <returns>Single line reply value</returns>
        string ExpectSingleLineReply();

        /// <summary>
        /// Waits for a bulk reply from the server as a string.
        /// </summary>
        /// <returns></returns>
        string ExpectBulkReply();

        /// <summary>
        /// Waits for a bulk reply from the server as binary.
        /// </summary>
        /// <returns>Bulk byte array</returns>
        byte[] ExpectBulkReplyBinary();

        /// <summary>
        /// Waits for a multi bulk reply from the server.
        /// </summary>
        /// <returns>Multi bulk string array.</returns>
        string[] ExpectMultiBulkReply();

        /// <summary>
        /// Waits for a multi bulk reply from the server in binary.
        /// </summary>
        /// <returns>Multi bulk byte/string array.</returns>
        byte[][] ExpectMultiBulkReplyBinary();

        /// <summary>
        /// Gets the port.
        /// </summary>
        /// <value>The port.</value>
        int Port { get; }

        /// <summary>
        /// Gets the ip address.
        /// </summary>
        /// <value>The ip address.</value>
        string IpAddress { get;  }
    }
}
